<template>
    <div>
        <h1>你好啊</h1>
        <div>
            <button @click="students">点击请求5001服务器</button>
            <button @click="cars">点击请求5002服务器</button>
        </div>
    </div>
</template>

<script>
import axios from "axios";
export default {
    name: "App",
    methods: {
        students() {
            axios.get("http://localhost:8080/5001/students").then(
                (responce) => {
                    console.log("请求成功：");
                    console.log(responce.data);
                },
                (error) => {
                    console.log("请求失败：");
                    console.log(error.message);
                }
            );
        },
        cars() {
            axios.get("http://localhost:8080/5002/cars").then(
                (responce) => {
                    console.log("请求成功：");
                    console.log(responce.data);
                },
                (error) => {
                    console.log("请求失败：");
                    console.log(error.message);
                }
            );
        },
    },
};
</script>

<style></style>
